﻿<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <meta charset="utf-8" />
    <script src="../Scripts/jquery-1.11.3.min.js"></script>

    <link href="../Scripts/Uploader6.1/Uploader6.1.css" rel="stylesheet" />
    <script src="../Scripts/Uploader6.1/Uploader6.1.js"></script>
</head>
<body>
    <br /><br /><br />
    <div>
        上传文件名：
        <span id="name"></span>
        <br />
        <br />
        相对目录： <span id="relativeName"></span>
    </div>
    <br /><br /><br />
    <div class="uploader uploader-default" id="uploadBtn"></div>
    <br />
    <br /><br />
    <script>
        ///*******使用WebScoket 方式处理传输*******/
        //var uploader = $('#uploadBtn').uploader({
        //    url: 'ws://localhost:63588/ashx/upload.ashx',
        //    fileExts:'*',
        //    text: '简单上传按钮',
        //    onSuccess: function (data) {
        //        console.info(data);
        //        $('#name').text(data.newName);
        //        $('#relativeName').text(data.relativeName);
        //    }
        //});

        /*******使用Ajax 方式处理传输*******/
        var uploader = $('#uploadBtn').uploader({
            url: '../ashx/upload_ajax.ashx',
            fileExts: '*',
            isImg: true,
            onSendImg: function (dataUrl, handle) {
                var img = new Image();
                img.onload = function () {
                    console.info(img.width);
                    console.info(img.height);
                    handle();
                }
                img.src = dataUrl;
            },
            text: '简单上传按钮',
            onSuccess: function (data) {
                console.info(data);
                $('#name').text(data.newName);
                $('#relativeName').text(data.relativeName);
            }
        });
    </script>
   


</body>
</html>
